use rand::{thread_rng, Rng};

pub fn random_f32() -> f32 {
    thread_rng().gen::<f32>()
}

pub fn random_f32_in_range(min: f32, max: f32) -> f32 {
    thread_rng().gen_range(min..max)
}



#[cfg(test)]
mod tests {

    use super::*;
    #[test]
    fn test_rand() {
        let mut  r = thread_rng();
        for _ in 0..10 {
            println!("rand: {}", r.gen::<f32>());
        }

        let mut range = thread_rng();
        for _ in 0..5 {
            println!("rand: {}",range.gen_range(2.0..5.0));
        }
            
    }
}